package com.example240703;

import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

@Transactional
public interface PersonReposity extends JpaRepository<Person, Integer> {
    @Query(value = "SELECT EXISTS (SELECT 1 FROM zhujing WHERE id_seq = :id_seq);",
            nativeQuery = true)
    Long existsIdSeq(@Param("id_seq") String id_seq);

    @Query(value = "SELECT * FROM zhujing WHERE id_seq = :id_seq LIMIT 1;",
            nativeQuery = true)
    Person findByIdSeq(@Param("id_seq") String id_seq);


//    @Modifying
//    @Query(value = "DELETE FROM zhujing  WHERE id_seq = :id_seq LIMIT 1;",
//            nativeQuery = true)
//    int deleteByIdSeq(@Param("id_seq") String id_seq);
}
